package tr.edu.metu.is.mega.client.menu;

import tr.edu.metu.is.mega.client.core.AuthUtils;

import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Window;

/**
 * Class for menu action handlers.
 */
public final class MenuActionFactory {

    /**
     * Hidden constructor.
     */
    private MenuActionFactory() {
    }

    /**
     * Determines action to perform with given featureIdentifier.
     * 
     * @param featureIdentifier menu featureIdentifier
     */
    public static void doAction(String featureIdentifier) {
        if (featureIdentifier.equals("logout")) {
            AuthUtils.getInstance().logout();
            History.newItem("", false);
            Window.Location.reload();
        } else {
            History.newItem(featureIdentifier);
        }

        /*
         * MainWindow window = MenuWindowFactory.getInstance(featureIdentifier);
         * ScreenMediator.getInstance().display(window);
         */
    }

}
